#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e7 + 5;
const int mod = 998244353;
int n, m;
int fac[maxn], ifac[maxn];
int pri[maxn];
int len = 0, pw[maxn];
bool isp[maxn];
int qpow(int x, int y){
    int res = 1;
    while(y){
	if(y & 1) res = 1ll * res * x % mod;
	x = 1ll * x * x % mod; y >>= 1;
    }
    return res;
}
void init(){
    fac[0] = 1;
    for(int i = 1;i <= m;i++){
	fac[i] = 1ll * i * fac[i - 1] % mod;
    }
    ifac[m] = qpow(fac[m], mod - 2);
    for(int i = m - 1;i >= 0;i--){
	ifac[i] = 1ll * (i + 1) * ifac[i + 1] % mod;
    }
    for(int i = 1;i <= m;i++) isp[i] = 1;
    isp[1] = 0; pw[1] = 1;
    for(int i = 2;i <= m;i++){
	if(isp[i]){
	    pw[i] = qpow(i, m); pri[++len] = i;
	}
	for(int j = 1;j <= len && 1ll * i * pri[j] <= m;j++){
	    isp[i * pri[j]] = 0; pw[i * pri[j]] = 1ll * pw[i] * pw[pri[j]] % mod;
	    if(i % pri[j] == 0) break;
	}
    }
    return ;
}
int f[maxn], g[maxn];
inline void upd(int &x, int y){
    return x = x + y >= mod ? x + y - mod : x + y, void();
}
int main(){
    freopen("drama.in", "r", stdin);
    freopen("drama.out", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m; init();
    for(int i = 0;i <= m;i++){
	f[i] = ((i & 1) ? mod - ifac[i] : ifac[i]);
	g[i] = 1ll * ifac[i] * pw[i] % mod;
	if(i) upd(g[i], g[i - 1]);
    }
    // for(int i = m + 1;i <= n;i++) upd(g[i], g[i - 1]);
    int ans = 0;
    for(int i = 0;i <= n && i <= m;i++){
	upd(ans, 1ll * f[i] * g[min(n, m) - i] % mod);
    }
    cout << ans << endl; return 0;
}
